#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<stdlib.h>

int cmp(const void* a, const void* b)
{
    return *(int*)a - *(int*)b;
}
int findContentChildren(int* g, int gSize, int* s, int sSize)
{
    qsort(g, gSize, sizeof(int), cmp);
    qsort(s, sSize, sizeof(int), cmp);
    int ret = 0;
    for (int i = 0, j = 0; i < gSize && j < sSize; i++, j++)
    {
        while (j<sSize && g[i]>s[j])
        {
            j++;
        }
        if (j < sSize)
            ret++;

    }
    return ret;
}